home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 11
/
Cream of the Crop 11-2.iso
/
extra_2
/
testvb.zip
/
MAIN.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-11-02
|
2KB
|
82 lines
//-------------------------------------------------------------------
// MAIN.CPP
// Copyright (c) 1995 by Golden Gate Software
// Written by:
// Richard D. Kligman
// 3825 Baker Street
// San Diego, CA 92117-5706
// (619) 483-8496
// FAX: (619) 483-4651
// CompuServe: 75300,2530
//-------------------------------------------------------------------
#include <windows.h>
#include <string.h>
#include "main.h"
extern "C" int FAR PASCAL LibMain(HANDLE hInstance, WORD wDataSeg, WORD wHeapSize, LPSTR lpsxCmdLine);
int FAR PASCAL LibMain(HANDLE hInstance, WORD wDataSeg, WORD wHeapSize, LPSTR lpsxCmdLine)
{
if (wHeapSize > 0)
UnlockData(0);
return 1;
}
//-------------------------------------------------------------------
// Constructor for MyClass
//-------------------------------------------------------------------
MyClass::MyClass()
{
}
//-------------------------------------------------------------------
// Destructor for MyClass
//-------------------------------------------------------------------
MyClass::~MyClass()
{
}
//-------------------------------------------------------------------
// Take two strings and make a third concatonated string
//-------------------------------------------------------------------
void MyClass::AddStrings(const char* strA, const char* strB, char* newStr, int len)
{
// Keep track of the total length of the string. We don't want to exceed
// the space allocated.
int totalLen;
// Copy the first string up to the length of the string allocated
strncpy(newStr, strA, len);
newStr[len-1] = NULL;
// Find out how big newStr is now
totalLen = strlen(newStr);
// Add the second string to the first up to the allocated space
strncat(newStr, strB, (len - totalLen));
newStr[len-1] = NULL;
}
//-------------------------------------------------------------------
// C interface function
//-------------------------------------------------------------------
void _export PASCAL AddStrings(const char* strA, const char* strB, char* newStr, int len)
{
// Instantiate MyClass
MyClass classA;
// Call the concatonation function in MyClass
classA.AddStrings(strA, strB, newStr, len);
}